<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'category-form',
	'enableAjaxValidation'=>true,
)); ?>

	<?php echo Yii::t('admin','<p class="note">Fields with <span class="required">*</span> are required.</p>');?>	


	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'cate_name'); ?>
		<?php echo $form->textField($model,'cate_name',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'cate_name'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'cate_link'); ?>
		<?php echo $form->textField($model,'cate_link',array('size'=>60,'maxlength'=>500)); ?>
		<?php echo $form->error($model,'cate_link'); ?>
	</div>
	
	<div class="row left column3">
		<?php echo $form->labelEx($model,'cate_type'); ?>
		<?php echo $form->dropDownList($model,'cate_type',
				Category::model()->generateCategoryDropdownListArray(),array(
							'options'=>array($model->cate_type=>array('selected'=>true)),
//							'style'=>'width:100%;'
		)); ?>
		<?php echo $form->error($model,'cate_type'); ?>
	</div>
	
	<div class="row left column3">
		<?php echo $form->labelEx($model,'cate_pid'); ?>
		<?php if($model->cate_pid == 0):?>
		<?php $dropdownlist = array_merge(array(0=>'无'),Category::model()->getCategoryDropdownList($model->cate_type));?>
		<?php else :?>
		<?php $dropdownlist = Category::model()->getCategoryDropdownList($model->cate_type);?>
		<?php endif;?>
		<?php echo $form->dropDownList($model,'cate_pid',$dropdownlist,array(
				'options'=>array($model->cate_pid=>array('selected'=>true)),
//				'style'=>'width:100%;'											
		)); ?>	
		
		<?php echo $form->error($model,'cate_pid'); ?>
	</div>
	<div class="clear"></div>
	
	<div class="row column3">
		<?php echo $form->labelEx($model,'cate_contype'); ?>
		<?php echo $form->dropDownList($model,'cate_contype',Category::model()->generateContentTypeDropdownListArray()); ?>
		<?php echo $form->error($model,'cate_contype'); ?>
	</div>	
	<div class="row column3">
		<?php echo $form->labelEx($model,'cate_recommend'); ?>
		<?php echo $form->dropDownList($model,'cate_recommend',Category::model()->generateCategoryRecommendDropdownListArray()); ?>
		<?php echo $form->error($model,'cate_recommend'); ?>
	</div>	
	<div class="row column3">
		<?php echo $form->labelEx($model,'cate_order'); ?>
		<?php echo $form->textField($model,'cate_order'); ?>
		<?php echo $form->error($model,'cate_order'); ?>
	</div>
	<div class="clear"></div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'cate_des'); ?>
		<?php echo $form->textArea($model,'cate_des',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'cate_des'); ?>
	</div>

	<div class="row buttons">
		<?php $this->widget('zii.widgets.jui.CJuiButton',
				array(
					'name'=>'button',
					'buttonType'=>'button',
					'htmlOptions'=>array(
						'id'=>'cate_submit'
					),
					'caption'=>$model->isNewRecord ? Yii::t('admin','Create') : Yii::t('admin','Save'),
					///'onclick'=>'js:function(){alert("Save button clicked"); this.blur(); return false;}',
				)
			);
		?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->